import pandas as pd

df1 = pd.DataFrame(
    {
        'var1':1.0,
        'var2':[1,2,3,4],
        'var3':["test","train","test","train"],
        'var4':'cons'
    }
)

df2 = pd.DataFrame(
    data=[
        [1,"test"],
        [2,"train"],
        [3,"test"]
    ], #数据列表，字典格式时直接同时提供变量名
    columns=['var2','var3']  #变量名列表

)

df3 = pd.Series(data=["test1","test2","test3"],name='var3')

print(df1)
print(df2)
print(df3)